{% extends "./appMonitor/base.html" %}

{% block envhostinfo %}
<div class="content-hostInfo">
    {% if hostList %}
        <h4><span>{{ envObj.name }}：</span>一共由{{ hostList|length }} 台服务器组成，服务器列表信息如下：</h4>
        <table class="table-bordered table-hover table-striped table-condensed text-center">
            <thead>
                <tr>
                    <th class="text-center">序号</th>
                    <th class="text-center">uuid</th>
                    <th class="text-center">主机名</th>
                    <th class="text-center">公网IP</th>
                    <th class="text-center">内网IP</th>
                    <th class="text-center">描述</th>
                </tr>
            </thead>
            <tbody>
                {% for host in hostList %}
                    <tr>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ host.id }}</td>
                        <td>{{ host.hostname }}</td>
                        <td>{{ host.internetIP }}</td>
                        <td>{{ host.intranetIP }}</td>
                        <td>{{ host.desc }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% endif %}
</div>
{% endblock %}




{% block envhostappinfo %}
<div class="content-applicationInfo">
    <div class="appHostList">
        <span>请选择主机:</span>
        {% if hostList %}
            {% for host in hostList %}
                <a class="btn btn-info btn-sm" href="{% url 'appMonitor:application' envObj.pk host.pk %}"><span>{{ host }}</span></a>
            {% endfor %}
        {% endif %}
        <a class="btn btn-info btn-sm" href="{% url 'appMonitor:updataServerData' envObj.pk %}"><span>刷新后台数据(约2分钟)</span></a>
    </div>

    <div class="appDetailInfo">
        {% if applicationList %}
            <table class="table-bordered table-hover table-striped table-condensed text-left">
                <thead>
                    <tr>
                        <th class="text-center">序号</th>
                        <th class="text-center">UUID</th>
                        <th class="text-center">应用名</th>
                        <th class="text-center">监听端口</th>
                    </tr>
                </thead>
                <tbody>
                    {% for app in applicationList %}
                        <tr>
                            <td class="text-center">{{ forloop.counter }}</td>
                            <td class="text-center">{{ app.pk }}</td>
                            <td><a href="{% url 'appMonitor:appDetail' app.pk %}">{{ app.appname }}</a></td>
                            <td>
                                {% for port in app.get_ports %}
                                    {{ port }}
                                {% endfor %}
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>
            <span>共{{ applicationList | length }}</span>
        {% endif %}
    </div>
</div>
{% endblock %}